/*

Copyright (c) 2004-2009 Krzysztof Ostrowski. All rights reserved.

Redistribution and use in source and binary forms,
with or without modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials provided
   with the distribution.

THIS SOFTWARE IS PROVIDED "AS IS" BY THE ABOVE COPYRIGHT HOLDER(S)
AND ALL OTHER CONTRIBUTORS AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDER(S) OR ANY OTHER
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

*/

using System;
using System.Collections.Generic;
using System.Text;

namespace QS.Fx.Network
{
    /// <summary>
    /// This class represents a send socket.
    /// </summary>
    public interface ISender : QS.Fx.Base.IParametrized
    {
        /// <summary>
        /// The local address of the network interafce with which the socket was associated.
        /// </summary>
        System.Net.IPAddress InterfaceAddress
        {
            get;
        }

        /// <summary>
        /// The destination address where data is sent.
        /// </summary>
        QS.Fx.Network.NetworkAddress Address
        {
            get;
        }

        /// <summary>
        /// Schedule a transmission of a packet.
        /// </summary>
        /// <param name="data">The segment of managed or unmanaged memory to be transmitted to the destination.</param>
        void Send(QS.Fx.Network.Data data);

        /// <summary>
        /// Schedule a transmission of a packet and notify when data has actually been transmitted.
        /// </summary>
        /// <param name="data">The segment of managed or unmanaged memory to be transmitted to the destination.</param>
        /// <param name="completionCallback">The callback to invoke when the data has been physically transmitted.</param>
        /// <param name="context">The context object to pass to the callback.</param>
        void Send(QS.Fx.Network.Data data, QS.Fx.Base.ContextCallback completionCallback, object context);

        /// <summary>
        /// Schedule a transmission of a longer stream of packets by associating a data feed with the socket.
        /// </summary>
        /// <param name="source"></param>
        void Send(QS.Fx.Network.ISource source);
    }
}
